
Imports std

Module replaceW

    Sub Main(ByVal args() As String)
        On Error Resume Next

        If isdebugmode() Then
            pause()
        End If

        If args.Length < 2 Then
            raiseError("argument count error, input output mapping0.0 mapping0.1 ... mappingN.0 mappingN.1, " + _
                        "if input or output is '/-', use console, program will transform backslashes", _
                        errorHandle.errorType.critical)
        Else
            Dim i As Int32
            dim replacer as vector(of pair(of string,string))=nothing
            replacer=new vector(of pair(of string,string))
            for i=2 to args.length()-2 step 2
                replacer.push_back(make_pair(args(i), args(i + 1)))
            next

            gainshar.replace(replacer, args(0), args(1))
        End If
    End Sub

End Module
